home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / swanson / sysinfo.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-01-06  |  12.1 KB  |  353 lines

  1. VERSION 2.00
  2. Begin Form frmSysInfo 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "System Info - Ver 1.1"
  6.    ClientHeight    =   3900
  7.    ClientLeft      =   1305
  8.    ClientTop       =   2055
  9.    ClientWidth     =   5760
  10.    Height          =   4305
  11.    Left            =   1245
  12.    LinkTopic       =   "Form2"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   3900
  16.    ScaleWidth      =   5760
  17.    Top             =   1710
  18.    Width           =   5880
  19.    Begin CommandButton ExitButton 
  20.       Caption         =   "&OK"
  21.       Default         =   -1  'True
  22.       Height          =   375
  23.       Index           =   0
  24.       Left            =   4770
  25.       TabIndex        =   22
  26.       Top             =   195
  27.       Width           =   885
  28.    End
  29.    Begin SSFrame Frame3D2 
  30.       Caption         =   "System Info"
  31.       ForeColor       =   &H00000000&
  32.       Height          =   2535
  33.       Left            =   120
  34.       TabIndex        =   5
  35.       Top             =   1250
  36.       Width           =   4485
  37.       Begin SSPanel DOSVer 
  38.          Alignment       =   1  'Left Justify - MIDDLE
  39.          BevelOuter      =   1  'Inset
  40.          ForeColor       =   &H00000000&
  41.          Height          =   255
  42.          Left            =   3820
  43.          TabIndex        =   20
  44.          Top             =   250
  45.          Width           =   525
  46.       End
  47.       Begin SSPanel WinPaging 
  48.          Alignment       =   1  'Left Justify - MIDDLE
  49.          BevelOuter      =   1  'Inset
  50.          ForeColor       =   &H00000000&
  51.          Height          =   255
  52.          Left            =   1650
  53.          TabIndex        =   18
  54.          Top             =   900
  55.          Width           =   2700
  56.       End
  57.       Begin SSPanel WinVer 
  58.          Alignment       =   1  'Left Justify - MIDDLE
  59.          BevelOuter      =   1  'Inset
  60.          ForeColor       =   &H00000000&
  61.          Height          =   255
  62.          Left            =   1650
  63.          TabIndex        =   16
  64.          Top             =   250
  65.          Width           =   525
  66.       End
  67.       Begin SSPanel CpuType 
  68.          Alignment       =   1  'Left Justify - MIDDLE
  69.          BevelOuter      =   1  'Inset
  70.          ForeColor       =   &H00000000&
  71.          Height          =   255
  72.          Left            =   1650
  73.          TabIndex        =   14
  74.          Top             =   1230
  75.          Width           =   2700
  76.       End
  77.       Begin SSPanel FreeRes 
  78.          Alignment       =   1  'Left Justify - MIDDLE
  79.          BevelOuter      =   1  'Inset
  80.          ForeColor       =   &H00000000&
  81.          Height          =   255
  82.          Left            =   1650
  83.          TabIndex        =   12
  84.          Top             =   2190
  85.          Width           =   2700
  86.       End
  87.       Begin SSPanel CoProc 
  88.          Alignment       =   1  'Left Justify - MIDDLE
  89.          BevelOuter      =   1  'Inset
  90.          ForeColor       =   &H00000000&
  91.          Height          =   255
  92.          Left            =   1650
  93.          TabIndex        =   10
  94.          Top             =   1860
  95.          Width           =   2700
  96.       End
  97.       Begin SSPanel WinMode 
  98.          Alignment       =   1  'Left Justify - MIDDLE
  99.          BevelOuter      =   1  'Inset
  100.          ForeColor       =   &H00000000&
  101.          Height          =   255
  102.          Left            =   1650
  103.          TabIndex        =   7
  104.          Top             =   570
  105.          Width           =   2700
  106.       End
  107.       Begin SSPanel FreeMem 
  108.          Alignment       =   1  'Left Justify - MIDDLE
  109.          BevelOuter      =   1  'Inset
  110.          ForeColor       =   &H00000000&
  111.          Height          =   255
  112.          Left            =   1650
  113.          TabIndex        =   6
  114.          Top             =   1545
  115.          Width           =   2700
  116.       End
  117.       Begin Label Label8 
  118.          Alignment       =   1  'Right Justify
  119.          BackColor       =   &H00C0C0C0&
  120.          Caption         =   "DOS Ver:"
  121.          Height          =   180
  122.          Index           =   1
  123.          Left            =   2950
  124.          TabIndex        =   21
  125.          Top             =   255
  126.          Width           =   840
  127.       End
  128.       Begin Label vm 
  129.          Alignment       =   1  'Right Justify
  130.          BackColor       =   &H00C0C0C0&
  131.          Caption         =   "Virtual Memory:"
  132.          Height          =   180
  133.          Left            =   90
  134.          TabIndex        =   19
  135.          Top             =   945
  136.          Width           =   1550
  137.       End
  138.       Begin Label Label8 
  139.          Alignment       =   1  'Right Justify
  140.          BackColor       =   &H00C0C0C0&
  141.          Caption         =   "Win Ver:"
  142.          Height          =   180
  143.          Index           =   0
  144.          Left            =   90
  145.          TabIndex        =   17
  146.          Top             =   270
  147.          Width           =   1550
  148.       End
  149.       Begin Label Label7 
  150.          Alignment       =   1  'Right Justify
  151.          BackColor       =   &H00C0C0C0&
  152.          Caption         =   "Processor Type:"
  153.          Height          =   180
  154.          Left            =   90
  155.          TabIndex        =   15
  156.          Top             =   1230
  157.          Width           =   1550
  158.       End
  159.       Begin Label Label6 
  160.          Alignment       =   1  'Right Justify
  161.          BackColor       =   &H00C0C0C0&
  162.          Caption         =   "Free Resources:"
  163.          Height          =   180
  164.          Left            =   90
  165.          TabIndex        =   13
  166.          Top             =   2190
  167.          Width           =   1550
  168.       End
  169.       Begin Label Label5 
  170.          Alignment       =   1  'Right Justify
  171.          BackColor       =   &H00C0C0C0&
  172.          Caption         =   "Coprocessor:"
  173.          Height          =   180
  174.          Left            =   90
  175.          TabIndex        =   11
  176.          Top             =   1860
  177.          Width           =   1550
  178.       End
  179.       Begin Label Label4 
  180.          Alignment       =   1  'Right Justify
  181.          BackColor       =   &H00C0C0C0&
  182.          Caption         =   "Windows Mode:"
  183.          Height          =   180
  184.          Left            =   90
  185.          TabIndex        =   9
  186.          Top             =   615
  187.          Width           =   1550
  188.       End
  189.       Begin Label Label3 
  190.          Alignment       =   1  'Right Justify
  191.          BackColor       =   &H00C0C0C0&
  192.          Caption         =   "Free Memory:"
  193.          Height          =   180
  194.          Left            =   90
  195.          TabIndex        =   8
  196.          Top             =   1545
  197.          Width           =   1550
  198.       End
  199.    End
  200.    Begin SSFrame Frame3D1 
  201.       Caption         =   "Windows Dirs."
  202.       ForeColor       =   &H00000000&
  203.       Height          =   1035
  204.       Left            =   120
  205.       TabIndex        =   0
  206.       Top             =   120
  207.       Width           =   4485
  208.       Begin SSPanel WinSysDir 
  209.          Alignment       =   1  'Left Justify - MIDDLE
  210.          BevelOuter      =   1  'Inset
  211.          ForeColor       =   &H00000000&
  212.          Height          =   255
  213.          Left            =   1300
  214.          TabIndex        =   2
  215.          Top             =   585
  216.          Width           =   3000
  217.       End
  218.       Begin SSPanel WinDir 
  219.          Alignment       =   1  'Left Justify - MIDDLE
  220.          BevelOuter      =   1  'Inset
  221.          ForeColor       =   &H00000000&
  222.          Height          =   255
  223.          Left            =   1300
  224.          TabIndex        =   1
  225.          Top             =   270
  226.          Width           =   3000
  227.       End
  228.       Begin Label Label2 
  229.          Alignment       =   1  'Right Justify
  230.          BackColor       =   &H00C0C0C0&
  231.          Caption         =   "System Dir:"
  232.          Height          =   200
  233.          Left            =   70
  234.          TabIndex        =   4
  235.          Top             =   610
  236.          Width           =   1170
  237.       End
  238.       Begin Label Label1 
  239.          Alignment       =   1  'Right Justify
  240.          BackColor       =   &H00C0C0C0&
  241.          Caption         =   "Windows Dir:"
  242.          Height          =   200
  243.          Left            =   70
  244.          TabIndex        =   3
  245.          Top             =   300
  246.          Width           =   1170
  247.       End
  248.    End
  249. Option Explicit
  250. Declare Function GetDriveType Lib "Kernel" (ByVal nDrive As Integer) As Integer
  251. Declare Function GetTempDrive Lib "Kernel" (ByVal cDriveLetter As Integer) As Integer
  252. Declare Function GetEnvironment Lib "GDI" (ByVal lpPortName As String, lpEnviron As Any, ByVal nMaxCount As Integer) As Integer
  253. Declare Function GetDOSEnvironment Lib "Kernel" () As Long
  254. Declare Function GetDeviceCaps Lib "GDI" (ByVal hDC As Integer, ByVal nIndex As Integer) As Integer
  255. Declare Function GetWindowsDirectory Lib "Kernel" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer
  256. Declare Function GetSystemDirectory Lib "Kernel" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer
  257. Declare Function GetWinFlags Lib "Kernel" () As Long
  258. Declare Function GetFreeSpace Lib "Kernel" (ByVal wFlags As Integer) As Long
  259. Declare Function GetFreeSystemResources Lib "User" (ByVal fuSysResource As Integer) As Integer
  260. Declare Function GetVersion Lib "Kernel" () As Long
  261. Const WF_STANDARD = &H10
  262. Const WF_ENHANCED = &H20
  263. Const WF_80x87 = &H400
  264. Const WF_CPU286 = &H2
  265. Const WF_CPU386 = &H4
  266. Const WF_CPU486 = &H8
  267. Const WF_PAGING = &H800
  268. Const GFSR_GDIRESOURCES = &H1
  269. Const GFSR_SYSTEMRESOURCES = &H0
  270. Const GFSR_USERRESOURCES = &H2
  271. Function DosVersion ()
  272.   Dim Ver As Long
  273.   Dim DOSVer As Long
  274.   Ver = GetVersion()
  275.   DOSVer = Ver \ &H10000
  276.   DosVersion = Format((DOSVer \ 256) + ((DOSVer Mod 256) / 100), "Fixed")
  277. End Function
  278. Sub ExitButton_Click (Index As Integer)
  279.       
  280.   Unload Me
  281. End Sub
  282. Sub Form_Load ()
  283.     Dim WinFlags As Long
  284.     Dim x As Long
  285.     Dim Mode As String, Processor As String
  286.     ' Center the form
  287.     Me.Left = (Screen.Width / 2) - (frmSysInfo.Width / 2)
  288.     Me.Top = (Screen.Height / 2) - (frmSysInfo.Height / 2)
  289.     WinDir.Caption = GetWindowsDir()
  290.     WinSysDir.Caption = GetWindowsSysDir()
  291.     WinFlags = GetWinFlags()
  292.     If WinFlags And WF_ENHANCED Then
  293.       Mode = "386 Enhanced Mode"
  294.     Else
  295.       Mode = "Standard Mode"
  296.       vm.Enabled = False
  297.       WinPaging.Enabled = False
  298.     End If
  299.     WinMode.Caption = Mode
  300.     If WinFlags And WF_80x87 Then Processor = "Present" Else Processor = "None"
  301.     CoProc.Caption = Processor
  302.     x = GetFreeSpace(0)
  303.     FreeMem.Caption = Format$(x / 1024, "##") + " KB"
  304.     If WinFlags And WF_CPU286 Then
  305.         CpuType.Caption = "80286"
  306.     ElseIf WinFlags And WF_CPU386 Then
  307.         CpuType.Caption = "80386"
  308.     ElseIf WinFlags And WF_CPU486 Then
  309.         CpuType.Caption = "80486"
  310.     Else
  311.        CpuType.Caption = "Unknown Processor"
  312.     End If
  313.     If WinFlags And WF_PAGING Then
  314.         WinPaging.Caption = "Enabled"
  315.     Else
  316.         WinPaging.Caption = "Disabled"
  317.     End If
  318.     FreeRes.Caption = "System:" & Format$(GetFreeSystemResources(GFSR_SYSTEMRESOURCES)) & " GDI:" + Format$(GetFreeSystemResources(GFSR_GDIRESOURCES)) & " USER:" & Format$(GetFreeSystemResources(GFSR_USERRESOURCES))
  319.     WinVer.Caption = WindowsVersion()
  320.     DOSVer.Caption = DosVersion()
  321. End Sub
  322. Function GetWindowsDir () As String
  323.     Dim Temp$
  324.     Dim x As Integer
  325.     Temp$ = String$(145, 0)
  326.     x = GetWindowsDirectory(Temp$, 145)
  327.     Temp$ = Left$(Temp$, x)
  328.     If Right$(Temp$, 1) <> "\" Then
  329.       GetWindowsDir$ = Temp$ + "\"
  330.     Else
  331.       GetWindowsDir$ = Temp$
  332.     End If
  333. End Function
  334. Function GetWindowsSysDir () As String
  335.     Dim Temp$
  336.     Dim x As Integer
  337.     Temp$ = String$(145, 0)
  338.     x = GetSystemDirectory(Temp$, 145)
  339.     Temp$ = Left$(Temp$, x)
  340.     If Right$(Temp$, 1) <> "\" Then
  341.       GetWindowsSysDir$ = Temp$ + "\"
  342.     Else
  343.       GetWindowsSysDir$ = Temp$
  344.     End If
  345. End Function
  346. Function WindowsVersion ()
  347.   Dim Ver As Long
  348.   Dim WinVer As Long
  349.   Ver = GetVersion()
  350.   WinVer = Ver And &HFFFF&
  351.   WindowsVersion = Format((WinVer Mod 256) + ((WinVer \ 256) / 100), "Fixed")
  352. End Function
  353.